package biz.impl;

import java.util.Date;
import java.util.List;

import dao.MeetingDAO;
import dao.impl.MeetingDAOImpl;

import bean.Meeting;
import biz.MeetingBiz;

public class MeetingBizImpl implements MeetingBiz {
	MeetingDAO md=new MeetingDAOImpl();
	public boolean save(Meeting meeting) {
		try {
			md.save(meeting);
			return true;
		} catch (Exception e) {
			return false;
		}
	}

	public boolean update(Meeting meeting) {
		try {
			md.update(meeting);
			return true;
		} catch (Exception e) {
			return false;
		}
	}
	
	public boolean del(int mid) {
		// TODO Auto-generated method stub
		try {
			md.delete(mid);
			return true;
		} catch (RuntimeException e) {
			return false;
		}
	}

	public List<Meeting> getAll() {
		// TODO Auto-generated method stub
		List<Meeting> result = md.findAll();
		return result;
	}

	public Meeting getMeetingBytopic(String topic) {
		// TODO Auto-generated method stub
		return md.getMeetingBytopic(topic);
	}

	public List<Meeting> getMeetingBytype(String type) {
		// TODO Auto-generated method stub
		if (null == type || "".equals(type))
			type = "%";
		List<Meeting> result = md.findByProperty("type", type);
		return result;
	}

	public List<Meeting> getMeetingBymeetingState(String meetingState) {
		// TODO Auto-generated method stub
		if (null == meetingState || "".equals(meetingState))
			meetingState= "%";
		List<Meeting> result = md.findByProperty("meetingState",meetingState);
		return result;
	}

	public List<Meeting> getMeetingByparticipants(String participants) {
		// TODO Auto-generated method stub
		if (null == participants || "".equals(participants))
			participants= "%";
		List<Meeting> result = md.findByProperty("participants",participants);
		return result;
	}

	public List<Meeting> getMeetingBymeetingDate(String meetingDate) {
		// TODO Auto-generated method stub
		if (null ==meetingDate || "".equals(meetingDate))
			meetingDate= "%";
		List<Meeting> result = md.findByProperty("meetingDate",meetingDate);
		return result;
	}

	public Meeting getMeetingBymid(int mid) {
		// TODO Auto-generated method stub
		Meeting meeting=md.getMeetingBymid(mid);
		return meeting;
	}

	

}
